package main

import (
	"io/ioutil"
	"main/onvifprotocol"
	"net/http"
)

func readResponse(resp *http.Response) string {
	b, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		panic(err)
	}
	return string(b)
}
func main() {
	logic, _ := onvifprotocol.NewCameraDevice("192.168.10.32:80", "admin", "admin123456")
	//err := logic.FocusMove(map[string]interface{}{"Type":"Absolute","VideoSourceToken": "00000", "Position": float64(1), "Speed": float64(1)})
	//fmt.Println(err)
	logic.GetStreamUri()

	//logic.GetMoveOptions(nil)

	//logic.GetVideoEncoderConfiguration("000")
	//tests := [][3]string{
	//	{"<p nowrap>", "p", "nowrap"},
	//	{"<p nowrap >", "p", "nowrap"},
	//	{"<input checked/>", "input", "checked"},
	//	{"<input checked />", "input", "checked"},
	//}
	//for _, test := range tests {
	//	d := xml.NewDecoder(strings.NewReader(test[0]))
	//	d.Strict = false
	//	token, err := d.Token()
	//	fmt.Println(token.(xml.StartElement))
	//	return
	//	if _, ok := err.(*xml.SyntaxError); ok {
	//		fmt.Printf("Unexpected error: %v\n", err)
	//	}
	//	if token.(xml.StartElement).Name.Local != test[1] {
	//		fmt.Printf("Unexpected tag name: %v\n", token.(xml.StartElement).Name.Local)
	//	}
	//	attr := token.(xml.StartElement).Attr[0]
	//	if attr.Value != test[2] {
	//		fmt.Printf("Unexpected attribute value: %v\n", attr.Value)
	//	}
	//	if attr.Name.Local != test[2] {
	//		fmt.Printf("Unexpected attribute name: %v\n", attr.Name.Local)
	//	}
	//}

}
